package com.example.bookrecommendationjava.mapper;

import com.example.bookrecommendationjava.model.Like;
import com.example.bookrecommendationjava.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @BelongsProject: book-recommendation-java
 * @BelongsPackage: com.example.bookrecommendationjava.mapper
 * @Author: ZhShy
 * @CreateTime: 2022-03-17 19:51
 * @Description:
 */
@Mapper
public interface UserMapper {
    @Insert("insert into user (userName, userPassword) " +
            "values ('${userName}', '${userPassword}')")
    void insertIntoUser(User user);

    @Select("select * from user where userName='${userName}' " +
            "and userPassword = '${userPassword}'" )
    User selectFromUserByUserNameAndUserPassword(User user);

    @Select("select * from user where userId=${userId}")
    User selectFromUserByUserId(Integer userId);

    @Select("select userId from user where userId != ${userId}")
    List<Integer> selectUserIdFromUserByUserIdNotEqual(Integer userId);


}
